package com.fyzk.activity.myview;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;

public class BallScrollView extends ScrollView{
	
	/**
	 * 是否滑动到顶部
	 */
	private boolean isHDTop;
	/**
	 * 是否滑动到底部
	 */
	private boolean isHDBottom;
	
	public BallScrollView(Context context){
		this(context, null);
	}

	public BallScrollView(Context context, AttributeSet attrs) {
		super(context, attrs);
		isHDTop = true;
		isHDBottom = false;
	}

	@Override
	protected void onOverScrolled(int scrollX, int scrollY, boolean clampedX,
			boolean clampedY) {
		if (scrollY <= 0) {
			isHDTop = true;
		}else{
			isHDTop = false;
		}
		
		
		if(getScrollY() + getHeight() >=  computeVerticalScrollRange())
        {
			isHDBottom = true;
        }else{
        	isHDBottom = false;
        }

		
		super.onOverScrolled(scrollX, scrollY, clampedX, clampedY);
	}

	public boolean isHDTop() {
		return isHDTop;
	}

	public void setHDTop(boolean isHDTop) {
		this.isHDTop = isHDTop;
	}

	public boolean isHDBottom() {
		return isHDBottom;
	}

	public void setHDBottom(boolean isHDBottom) {
		this.isHDBottom = isHDBottom;
	}

	
	
	
}
